<%--
  Created by IntelliJ IDEA.
  User: luo
  Date: 2020/7/7
  Time: 19:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <title>理赔审核</title>
    <base href="${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}${pageContext.request.contextPath}/"/>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="static/lib/layui-v2.5.5/css/layui.css"  media="all">
</head>
<body>
<fieldset class="layui-elem-field" style="padding: 30px;">
    <legend>审核信息</legend>
    <table lay-filter="warranty" class="layui-hide" id="warranty"></table>
</fieldset>
<fieldset class="layui-elem-field" style="padding: 30px;">
    <legend>投保人信息</legend>
    <table lay-filter="policyholders" class="layui-hide" id="policyholders"></table>
</fieldset>
<fieldset class="layui-elem-field" style="padding: 30px;">
    <legend>被保人信息</legend>
    <table lay-filter="recognizee" class="layui-hide" id="recognizee"></table>
</fieldset>
<fieldset class="layui-elem-field" style="padding: 30px;">
    <legend>审核</legend>
    <form lay-filter="settlement" class="layui-form" action="">
        <div class="layui-form-item">
            <div class="layui-input-block">
                <input type="radio" name="settlementAudit" value="暂存" title="暂存">
                <input type="radio" name="settlementAudit" value="撤销" title="撤销">
                <input type="radio" name="settlementAudit" value="审核通过" title="审核通过">
            </div>
        </div>
        <button type="button" class="layui-btn layui-col-md-offset4" data-type="reload" id="search">确定</button>
        <button type="reset" class="layui-btn a_back layui-col-md-offset4"><i class="layui-icon layui-icon-close" style="font-size: 24px; color:red;"></i>关闭页面</button>
    </form>
</fieldset>
<script src="static/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script>
    var line = parent.line;
    layui.use(['jquery','form','table'], function(args){
        var $= layui.jquery;
        var form = layui.form;
        var table = layui.table;
        var layer = layui.layer;

        table.render({
            elem: '#warranty'
            ,url:'claims/getWarranty?policyNum='+line.policyNum
            ,width: 1400
            ,cols: [[
                {field:'warrantyid', minWidth:100, title: '保单编号',fixed: 'left'}
                ,{field:'policyholdersid', minWidth:100, title: '投保人'}
                ,{field:'recognizeeid', minWidth:100, title: '被保人号'}
                ,{field:'permissiontime', minWidth:100, title: '签单日期'}
                ,{field:'insurancebegintime', minWidth:100, title: '保险起期'}
                ,{field:'insuranceendtime', minWidth:100, title: '保险止期'}
                ,{field:'paymenttime', minWidth:100, title: '缴费时间'}
                ,{field:'premiumtotal', minWidth:100, title: '保费总额'}
                ,{field:'warrantytype', minWidth:100, title: '保单类型'}
                ,{field:'warrantystate', minWidth:100, title: '保单状态'}
                ,{field:'insuremoney', minWidth:100, title: '投保金额'}
                ,{field:'premiummoney', minWidth:100, title: '保费金额'}
                ,{field:'indemnifymax', minWidth:100, title: '赔偿限额'}
                ,{field:'engineid', minWidth:100, title: '发动机号'}
                ,{field:'frameid', minWidth:100, title: '车架号'}
                ,{field:'makeid', minWidth:100, title: '厂牌型号'}
                ,{field:'licenseid', minWidth:100, title: '车牌号码'}
                ,{field:'carcolor', minWidth:100, title: '车身颜色'}
                ,{field:'nature', minWidth:100, title: '使用性质'}
                ,{field:'minteddate', minWidth:100, title: '出厂日期'}
                ,{field:'customerssum', minWidth:100, title: '核定载客数'}
                ,{field:'sailint', minWidth:120, title: '车辆行驶证号'}
                ,{field:'carownername', minWidth:100, title: '车主姓名'}
                ,{field:'vpdollar', minWidth:100, title: '新车购置价'}
                ,{field:'placemanlength', minWidth:120, title: '实际使用年限'}
                ,{field:'bankname', minWidth:100, title: '银行名称'}
                ,{field:'bankcard', minWidth:100, title: '银行卡号'}
             ]]
            ,id:'warranty'
        });

        table.render({
            elem: '#policyholders'
            ,url:'claims/getPolicyholders?policyNum='+line.policyNum
            ,width: 1400
            ,cols: [[
                {field:'policyholdersid', minWidth:100, title: '投保人编号',fixed: 'left'}
                ,{field:'policyholdersname', minWidth:100, title: '投保人姓名'}
                ,{field:'sex', minWidth:100, title: '性别'}
                ,{field:'credentialstype', minWidth:100, title: '证件类型'}
                ,{field:'credenId', minWidth:100, title: '证件号码'}
                ,{field:'telephone', minWidth:100, title: '联系电话'}
                ,{field:'address', minWidth:100, title: '联系地址'}
            ]]
            ,id:'policyholders'
        });

        table.render({
            elem: '#recognizee'
            ,url:'claims/getRecognizee?policyNum='+line.policyNum
            ,width: 1400
            ,cols: [[
                {field:'recognizeeid', minWidth:100, title: '被保人编号',fixed: 'left'}
                ,{field:'recognizeename', minWidth:100, title: '被保人姓名'}
                ,{field:'sex', minWidth:100, title: '性别'}
                ,{field:'credentialstype', minWidth:100, title: '证件类型'}
                ,{field:'credentialsid', minWidth:100, title: '证件号码'}
                ,{field:'telephone', minWidth:100, title: '联系电话'}
                ,{field:'address', minWidth:100, title: '联系地址'}
                ,{field:'bank', minWidth:100, title: '银行名称'}
                ,{field:'bankaccount', minWidth:100, title: '银行账户'}
            ]]
            ,id:'recognizee'
        });

        $('.a_back').click(function () {
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        });

        //监听提交
        layui.$('#search').on('click', function(){
            layer.open({
                content: '确认要更改审核状态吗？'
                ,btn: ['确定', '取消']
                ,yes: function(index, layero){
                    var data = form.val('settlement');
                    data['settlementId'] = line.settlementId;
                    data['policyNum'] = line.policyNum;
                    $.ajax({
                        url:'/claims/upSettlement',
                        type:'get',
                        data:data,
                        dataType:"json",
                        success:function(data){
                            if(data){
                                layer.msg(data.data);
                                setTimeout(function () {
                                    var index = parent.layer.getFrameIndex(window.name);
                                    //关闭当前frame
                                    parent.layer.close(index);
                                    //修改成功后刷新父界面
                                    window.parent.location.reload();
                                }, 800);
                            }
                            else{
                                layer.msg(data.data);
                            }
                        },
                        error:function(e){
                            layer.msg("审核失败！")
                        },

                    });
                    return false;
                }
                ,btn2: function(index, layero){
                    layer.close(index);
                }
            });
        });
    });
    layui.use(['jquery'], function(args) {
        var $= layui.jquery;

        if(line.settlementAudit=="暂存"){
            $("input[title='暂存']").prop("checked","true");
        }else if(line.settlementAudit=="撤销"){
            $("input[title='撤销']").prop("checked","true");
        }
    });
</script>
</body>
</html>
